Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08c7e31b authored by Mingming Yin's avatar Mingming Yin
Browse files

hal: add support to use low lantecy as primay output

- Add support to use low lantency output as primary
  output when AUDIO_USE_LL_AS_PRIMARY_OUTPUT is enabled

Change-Id: Ie7faf9f7af4c97b7afdda8084b7acf162abbc0b6
parent 52f8653d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_HDMI_EDID)),true)
    LOCAL_SRC_FILES += edid.c
endif

ifeq ($(strip $(AUDIO_USE_LL_AS_PRIMARY_OUTPUT)),true)
    LOCAL_CFLAGS += -DUSE_LL_AS_PRIMARY_OUTPUT
endif

ifeq ($(strip $(AUDIO_FEATURE_ENABLED_PCM_OFFLOAD)),true)
    LOCAL_CFLAGS += -DPCM_OFFLOAD_ENABLED
endif
+12 −1
Original line number Diff line number Diff line
@@ -81,7 +81,13 @@
#define PROXY_OPEN_RETRY_COUNT           100
#define PROXY_OPEN_WAIT_TIME             20

#ifdef USE_LL_AS_PRIMARY_OUTPUT
#define USECASE_AUDIO_PLAYBACK_PRIMARY USECASE_AUDIO_PLAYBACK_LOW_LATENCY
#define PCM_CONFIG_AUDIO_PLAYBACK_PRIMARY pcm_config_low_latency
#else
#define USECASE_AUDIO_PLAYBACK_PRIMARY USECASE_AUDIO_PLAYBACK_DEEP_BUFFER
#define PCM_CONFIG_AUDIO_PLAYBACK_PRIMARY pcm_config_deep_buffer
#endif

static unsigned int configured_low_latency_capture_period_size =
        LOW_LATENCY_CAPTURE_PERIOD_SIZE;
@@ -2940,11 +2946,16 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
        out->usecase = USECASE_AUDIO_PLAYBACK_LOW_LATENCY;
        out->config = pcm_config_low_latency;
        out->sample_rate = out->config.rate;
    } else if (out->flags & AUDIO_OUTPUT_FLAG_DEEP_BUFFER) {
        format = AUDIO_FORMAT_PCM_16_BIT;
        out->usecase = USECASE_AUDIO_PLAYBACK_DEEP_BUFFER;
        out->config = pcm_config_deep_buffer;
        out->sample_rate = out->config.rate;
    } else {
        /* primary path is the default path selected if no other outputs are available/suitable */
        format = AUDIO_FORMAT_PCM_16_BIT;
        out->usecase = USECASE_AUDIO_PLAYBACK_PRIMARY;
        out->config = pcm_config_deep_buffer;
        out->config = PCM_CONFIG_AUDIO_PLAYBACK_PRIMARY;
        out->sample_rate = out->config.rate;
    }