hdmi audio: cache alsa device

* It's always been intended that changing audio output devices requires
  a reboot. Get the ALSA device once when the HAL is initialized.
  Might save a few ms on start_output_stream.
This commit is contained in:
Konsta
2025-03-31 00:51:09 +03:00
parent 5420780e92
commit bc7579e2a5

View File

@@ -55,6 +55,8 @@
#define CHANNEL_STEREO 2
#define MIN_WRITE_SLEEP_US 5000
char device_name[PROPERTY_VALUE_MAX];
struct stub_stream_in {
struct audio_stream_in stream;
};
@@ -101,8 +103,6 @@ static int start_output_stream(struct alsa_stream_out *out)
if (out->unavailable)
return -ENODEV;
char device_name[PROPERTY_VALUE_MAX];
get_alsa_device_name(device_name);
ALOGI("start_output_stream: %s", device_name);
int r;
@@ -717,6 +717,9 @@ static int adev_open(const hw_module_t* module, const char* name,
ALOGV("adev_open: %s", name);
get_alsa_device_name(device_name);
ALOGI("adev_open: %s", device_name);
if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0)
return -EINVAL;