Skip to content

Commit

Permalink
CRAS: utilize spatial audio state in system state
Browse files Browse the repository at this point in the history
Utilize spatial audio state in system state to keep the state of UI
selected enablement of spatial audio.

BUG=b:317748801
TEST=FEATURES=test USE=asan emerge-${BOARD} adhd

Change-Id: I663fe01c1a4c5c5d774ffff2e65347ba3f9eb791
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/5523798
Reviewed-by: Hung-Hsien Chen <hunghsienchen@chromium.org>
Tested-by: chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com <chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com>
Reviewed-by: Li-Yu Yu <aaronyu@google.com>
Commit-Queue: Eddy Hsu <eddyhsu@chromium.org>
  • Loading branch information
Eddy Hsu authored and Chromeos LUCI committed Oct 4, 2024
1 parent cf4644a commit cd52040
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cras/src/server/cras_dbus_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1519,6 +1519,22 @@ static inline DBusHandlerResult handle_get_number_of_arc_streams(
return send_int32_reply(conn, message, cras_system_state_num_arc_streams());
}

static DBusHandlerResult handle_set_spatial_audio_enabled(DBusConnection* conn,
DBusMessage* message,
void* arg) {
int rc;
dbus_bool_t enabled;

rc = get_single_arg(message, DBUS_TYPE_BOOLEAN, &enabled);
if (rc) {
return rc;
}

cras_s2_set_spatial_audio_enabled(enabled);

return send_empty_reply(conn, message);
}

// Handle incoming messages.
static DBusHandlerResult handle_control_message(DBusConnection* conn,
DBusMessage* message,
Expand Down Expand Up @@ -1752,6 +1768,9 @@ static DBusHandlerResult handle_control_message(DBusConnection* conn,
} else if (dbus_message_is_method_call(message, CRAS_CONTROL_INTERFACE,
"GetNumberOfArcStreams")) {
return handle_get_number_of_arc_streams(conn, message, arg);
} else if (dbus_message_is_method_call(message, CRAS_CONTROL_INTERFACE,
"SetSpatialAudio")) {
return handle_set_spatial_audio_enabled(conn, message, arg);
}

return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
Expand Down

0 comments on commit cd52040

Please sign in to comment.