Skip to content

Commit edd23f8

Browse files
committed
audio: Make compressed playback support a build option
Allow building with or without compressed support. To enable support the device configuration must define TINYHAL_COMPRESS_PLAYBACK := true Change-Id: I72375f2727ad3aaa818185defecfc5f8c947964a Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
1 parent c4eb89c commit edd23f8

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

audio/Android.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ ifeq ($(strip $(TINYCOMPRESS_TSTAMP_IS_LONG)),true)
7272
LOCAL_CFLAGS += -DTINYCOMPRESS_TSTAMP_IS_LONG
7373
endif
7474

75+
ifeq ($(strip $(TINYHAL_COMPRESS_PLAYBACK)),true)
76+
LOCAL_CFLAGS += -DTINYHAL_COMPRESS_PLAYBACK
77+
endif
7578

7679
include $(BUILD_SHARED_LIBRARY)
7780

audio/audio_hw.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@
4040
#include <system/audio.h>
4141

4242
#include <tinyalsa/asoundlib.h>
43+
44+
#ifdef TINYHAL_COMPRESS_PLAYBACK
4345
#include <sound/compress_params.h>
4446
#include <sound/compress_offload.h>
4547
#include <tinycompress/tinycompress.h>
48+
#endif
4649

4750
#include <audio_utils/resampler.h>
4851

@@ -54,8 +57,6 @@
5457
#include <vendor/cirrus/scchal/scc_audio.h>
5558
#endif
5659

57-
#define TINYHAL_COMPRESS_PLAYBACK
58-
5960
/* These values are defined in _frames_ (not bytes) to match the ALSA API */
6061
#define OUT_PERIOD_SIZE_DEFAULT 256
6162
#define OUT_PERIOD_COUNT_DEFAULT 4
@@ -2091,15 +2092,15 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
20912092
goto err_open;
20922093
}
20932094

2094-
#ifdef TINYHAL_COMPRESS_PLAYBACK
20952095
if (hw->type == e_stream_out_pcm) {
20962096
ret = do_init_out_pcm(out.pcm, config);
20972097
} else {
2098+
#ifdef TINYHAL_COMPRESS_PLAYBACK
20982099
ret = do_init_out_compress(out.compress, config);
2099-
}
21002100
#else
2101-
ret = do_init_out_pcm(out.pcm, config);
2101+
ret = -ENOTSUP;
21022102
#endif
2103+
}
21032104

21042105
if (ret < 0) {
21052106
goto err_open;

0 commit comments

Comments
 (0)