aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHao Chen <chenhaosjtuacm@google.com>2020-08-05 13:43:01 -0700
committerHao Chen <chenhaosjtuacm@google.com>2020-08-05 21:57:53 +0000
commite8b220a5f3bc81d29418f30b29494062b64e1151 (patch)
treec82c4d567ef72cefa200786e042d396777d8cd9d
parent3d468cd7ddc604b26eb70bd8ae2702f75a12dbb9 (diff)
downloadcuttlefish-e8b220a5f3bc81d29418f30b29494062b64e1151.tar.gz
Set Kernel Command Line to Configure Audiocontrol Server
In Trout's audio control design (go/aae-vm-audio-focus), the audio control server lives in Android VM to receive audio focus requests from other VMs. The server address (cid and port) needs to be configured. Test: run (multiple) cvd instances, the address should be vsock:<guest cid>:9410 Bug: 162776858 Merged-In: Id70cfbe3257052858ca29743ccfd0afdfe7a063f Change-Id: Id70cfbe3257052858ca29743ccfd0afdfe7a063f
-rw-r--r--host/commands/assemble_cvd/flags.cc1
-rw-r--r--host/commands/run_cvd/kernel_args.cc5
-rw-r--r--host/libs/config/cuttlefish_config.cpp10
-rw-r--r--host/libs/config/cuttlefish_config.h3
4 files changed, 19 insertions, 0 deletions
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index 8562271aa..d3a43303d 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -428,6 +428,7 @@ vsoc::CuttlefishConfig InitializeCuttlefishConfiguration(
instance.set_adb_ip_and_port("127.0.0.1:" + std::to_string(6520 + num - 1));
instance.set_vehicle_hal_server_port(9210 + num - 1);
+ instance.set_audiocontrol_server_port(9410); /* OK to use the same port number across instances */
instance.set_device_title(FLAGS_device_title);
diff --git a/host/commands/run_cvd/kernel_args.cc b/host/commands/run_cvd/kernel_args.cc
index 308ef8a7c..50df09df8 100644
--- a/host/commands/run_cvd/kernel_args.cc
+++ b/host/commands/run_cvd/kernel_args.cc
@@ -95,6 +95,11 @@ std::vector<std::string> KernelCommandLineFromConfig(const vsoc::CuttlefishConfi
kernel_cmdline.push_back(concat("androidboot.vendor.vehiclehal.server.port=", instance.vehicle_hal_server_port()));
}
+ if (instance.audiocontrol_server_port()) {
+ kernel_cmdline.push_back(concat("androidboot.vendor.audiocontrol.server.cid=", instance.vsock_guest_cid()));
+ kernel_cmdline.push_back(concat("androidboot.vendor.audiocontrol.server.port=", instance.audiocontrol_server_port()));
+ }
+
// TODO(b/158131610): Set this in crosvm instead
kernel_cmdline.push_back(concat("androidboot.wifi_mac_address=",
mac_to_str(instance.wifi_mac_address())));
diff --git a/host/libs/config/cuttlefish_config.cpp b/host/libs/config/cuttlefish_config.cpp
index c11ed1660..1c561be40 100644
--- a/host/libs/config/cuttlefish_config.cpp
+++ b/host/libs/config/cuttlefish_config.cpp
@@ -130,6 +130,8 @@ const char* kEnableVehicleHalServer = "enable_vehicle_hal_server";
const char* kVehicleHalServerBinary = "vehicle_hal_server_binary";
const char* kVehicleHalServerPort = "vehicle_hal_server_port";
+const char* kAudioControlServerPort = "audiocontrol_server_port";
+
const char* kRestartSubprocesses = "restart_subprocesses";
const char* kRunAdbConnector = "run_adb_connector";
const char* kAdbConnectorBinary = "adb_connector_binary";
@@ -588,6 +590,14 @@ void CuttlefishConfig::MutableInstanceSpecific::set_vehicle_hal_server_port(int
(*Dictionary())[kVehicleHalServerPort] = vehicle_hal_server_port;
}
+int CuttlefishConfig::InstanceSpecific::audiocontrol_server_port() const {
+ return (*Dictionary())[kAudioControlServerPort].asInt();
+}
+
+void CuttlefishConfig::MutableInstanceSpecific::set_audiocontrol_server_port(int audiocontrol_server_port) {
+ (*Dictionary())[kAudioControlServerPort] = audiocontrol_server_port;
+}
+
void CuttlefishConfig::set_enable_webrtc(bool enable_webrtc) {
(*dictionary_)[kEnableWebRTC] = enable_webrtc;
}
diff --git a/host/libs/config/cuttlefish_config.h b/host/libs/config/cuttlefish_config.h
index e6a1e79e6..52425d894 100644
--- a/host/libs/config/cuttlefish_config.h
+++ b/host/libs/config/cuttlefish_config.h
@@ -292,6 +292,8 @@ class CuttlefishConfig {
int vnc_server_port() const;
// Port number to connect to the vehicle HAL server on the host
int vehicle_hal_server_port() const;
+ // Port number to connect to the audiocontrol server on the guest
+ int audiocontrol_server_port() const;
int host_port() const;
std::string adb_ip_and_port() const;
std::string adb_device_name() const;
@@ -350,6 +352,7 @@ class CuttlefishConfig {
void set_serial_number(const std::string& serial_number);
void set_vnc_server_port(int vnc_server_port);
void set_vehicle_hal_server_port(int vehicle_server_port);
+ void set_audiocontrol_server_port(int audiocontrol_server_port);
void set_host_port(int host_port);
void set_adb_ip_and_port(const std::string& ip_port);
void set_device_title(const std::string& title);