Skip to content

Instantly share code, notes, and snippets.

@xc-racer99
Created September 16, 2015 23:54
Show Gist options
  • Save xc-racer99/d1d5cff162ee4fa0239d to your computer and use it in GitHub Desktop.
Save xc-racer99/d1d5cff162ee4fa0239d to your computer and use it in GitHub Desktop.
From aa02778010b6a0499af3a6fc5675331bc3ade75f Mon Sep 17 00:00:00 2001
From: Eric Laurent <[email protected]>
Date: Thu, 23 Oct 2014 14:42:59 -0700
Subject: [PATCH] compress offload: use new sample rate representation.
Pass directly the sample rate value to struct snd_codec
instead of the ALSA enum.
Bug: 17398311.
Change-Id: I79483773807ce3b0b146fde28d6498444c69fe89
Conflicts:
hal/Android.mk
---
hal/Android.mk | 4 ++++
hal/audio_hw.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/hal/Android.mk b/hal/Android.mk
index 48cc665..a112577 100644
--- a/hal/Android.mk
+++ b/hal/Android.mk
@@ -110,6 +110,10 @@ ifeq ($(strip $(AUDIO_FEATURE_ENABLED_COMPRESS_CAPTURE)),true)
LOCAL_SRC_FILES += audio_extn/compress_capture.c
endif
+ifeq ($(strip $(AUDIO_FEATURE_ENABLED_NEW_SAMPLE_RATE)),true)
+ LOCAL_CFLAGS += -DNEW_SAMPLE_RATE_ENABLED
+endif
+
ifeq ($(strip $(DOLBY_DDP)),true)
LOCAL_CFLAGS += -DDS1_DOLBY_DDP_ENABLED
LOCAL_SRC_FILES += audio_extn/dolby.c
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 9156a00..be89824 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2426,8 +2426,12 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
platform_get_compress_offload_buffer_size(&config->offload_info);
}
out->compr_config.fragments = COMPRESS_OFFLOAD_NUM_FRAGMENTS;
+#ifdef NEW_SAMPLE_RATE_ENABLED
+ out->compr_config.codec->sample_rate = config->offload_info.sample_rate;
+#else
out->compr_config.codec->sample_rate =
compress_get_alsa_rate(config->offload_info.sample_rate);
+#endif
out->compr_config.codec->bit_rate =
config->offload_info.bit_rate;
out->compr_config.codec->ch_in =
--
2.1.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment