hal: fix hal build error for LE platform
Fix hal build error for LE platform Change-Id: Ib64f17f1cd11aa761c240f2cf0e8855349db579d
This commit is contained in:
parent
6011f262c4
commit
22768459bd
|
@ -148,6 +148,13 @@ struct pcm_config default_pcm_config_voip_copp = {
|
|||
#define STR(x) #x
|
||||
#endif
|
||||
|
||||
#ifdef LINUX_ENABLED
|
||||
static inline int64_t audio_utils_ns_from_timespec(const struct timespec *ts)
|
||||
{
|
||||
return ts->tv_sec * 1000000000LL + ts->tv_nsec;
|
||||
}
|
||||
#endif
|
||||
|
||||
static unsigned int configured_low_latency_capture_period_size =
|
||||
LOW_LATENCY_CAPTURE_PERIOD_SIZE;
|
||||
|
||||
|
@ -4805,7 +4812,7 @@ static int out_dump(const struct audio_stream *stream, int fd)
|
|||
const bool locked = (pthread_mutex_trylock(&out->lock) == 0);
|
||||
dprintf(fd, " Standby: %s\n", out->standby ? "yes" : "no");
|
||||
dprintf(fd, " Frames written: %lld\n", (long long)out->written);
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
char buffer[256]; // for statistics formatting
|
||||
if (!is_offload_usecase(out->usecase)) {
|
||||
simple_stats_to_string(&out->fifo_underruns, buffer, sizeof(buffer));
|
||||
|
@ -4816,15 +4823,16 @@ static int out_dump(const struct audio_stream *stream, int fd)
|
|||
simple_stats_to_string(&out->start_latency_ms, buffer, sizeof(buffer));
|
||||
dprintf(fd, " Start latency ms: %s\n", buffer);
|
||||
}
|
||||
|
||||
#endif
|
||||
if (locked) {
|
||||
pthread_mutex_unlock(&out->lock);
|
||||
}
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
// dump error info
|
||||
(void)error_log_dump(
|
||||
out->error_log, fd, " " /* prefix */, 0 /* lines */, 0 /* limit_ns */);
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -6016,9 +6024,11 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
|
|||
if (out->set_dual_mono)
|
||||
audio_extn_send_dual_mono_mixing_coefficients(out);
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
// log startup time in ms.
|
||||
simple_stats_log(
|
||||
&out->start_latency_ms, (systemTime(SYSTEM_TIME_MONOTONIC) - startNs) * 1e-6);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (adev->is_channel_status_set == false &&
|
||||
|
@ -6189,7 +6199,9 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
|
|||
const int64_t underrun = frames_by_time - out->last_fifo_frames_remaining;
|
||||
|
||||
if (underrun > 0) {
|
||||
#ifndef LINUX_ENABLED
|
||||
simple_stats_log(&out->fifo_underruns, underrun);
|
||||
#endif
|
||||
|
||||
ALOGW("%s: underrun(%lld) "
|
||||
"frames_by_time(%lld) > out->last_fifo_frames_remaining(%lld)",
|
||||
|
@ -6945,21 +6957,21 @@ static int in_dump(const struct audio_stream *stream,
|
|||
dprintf(fd, " Standby: %s\n", in->standby ? "yes" : "no");
|
||||
dprintf(fd, " Frames read: %lld\n", (long long)in->frames_read);
|
||||
dprintf(fd, " Frames muted: %lld\n", (long long)in->frames_muted);
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
char buffer[256]; // for statistics formatting
|
||||
if (in->start_latency_ms.n > 0) {
|
||||
simple_stats_to_string(&in->start_latency_ms, buffer, sizeof(buffer));
|
||||
dprintf(fd, " Start latency ms: %s\n", buffer);
|
||||
}
|
||||
|
||||
#endif
|
||||
if (locked) {
|
||||
pthread_mutex_unlock(&in->lock);
|
||||
}
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
// dump error info
|
||||
(void)error_log_dump(
|
||||
in->error_log, fd, " " /* prefix */, 0 /* lines */, 0 /* limit_ns */);
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7228,10 +7240,11 @@ static ssize_t in_read(struct audio_stream_in *stream, void *buffer,
|
|||
goto exit;
|
||||
}
|
||||
in->standby = 0;
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
// log startup time in ms.
|
||||
simple_stats_log(
|
||||
&in->start_latency_ms, (systemTime(SYSTEM_TIME_MONOTONIC) - startNs) * 1e-6);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Avoid read if capture_stopped is set */
|
||||
|
@ -8609,10 +8622,11 @@ int adev_open_output_stream(struct audio_hw_device *dev,
|
|||
register_channel_mask(out->channel_mask, out->supported_channel_masks);
|
||||
register_sample_rate(out->sample_rate, out->supported_sample_rates);
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
out->error_log = error_log_create(
|
||||
ERROR_LOG_ENTRIES,
|
||||
1000000000 /* aggregate consecutive identical errors within one second in ns */);
|
||||
|
||||
#endif
|
||||
/*
|
||||
By locking output stream before registering, we allow the callback
|
||||
to update stream's state only after stream's initial state is set to
|
||||
|
@ -8751,9 +8765,10 @@ void adev_close_output_stream(struct audio_hw_device *dev __unused,
|
|||
if (adev->voice_tx_output == out)
|
||||
adev->voice_tx_output = NULL;
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
error_log_destroy(out->error_log);
|
||||
out->error_log = NULL;
|
||||
|
||||
#endif
|
||||
if (adev->primary_output == out)
|
||||
adev->primary_output = NULL;
|
||||
|
||||
|
@ -9771,9 +9786,11 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
|
|||
register_channel_mask(in->channel_mask, in->supported_channel_masks);
|
||||
register_sample_rate(in->sample_rate, in->supported_sample_rates);
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
in->error_log = error_log_create(
|
||||
ERROR_LOG_ENTRIES,
|
||||
1000000000 /* aggregate consecutive identical errors within one second */);
|
||||
#endif
|
||||
|
||||
/* This stream could be for sound trigger lab,
|
||||
get sound trigger pcm if present */
|
||||
|
@ -9853,9 +9870,10 @@ static void adev_close_input_stream(struct audio_hw_device *dev,
|
|||
} else
|
||||
audio_extn_sound_trigger_update_ec_ref_status(false);
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
error_log_destroy(in->error_log);
|
||||
in->error_log = NULL;
|
||||
|
||||
#endif
|
||||
|
||||
if (in->usecase == USECASE_COMPRESS_VOIP_CALL) {
|
||||
pthread_mutex_lock(&adev->lock);
|
||||
|
|
|
@ -47,14 +47,34 @@
|
|||
#include <tinycompress/tinycompress.h>
|
||||
|
||||
#include <audio_route/audio_route.h>
|
||||
#ifndef LINUX_ENABLED
|
||||
#include <audio_utils/ErrorLog.h>
|
||||
#else
|
||||
typedef int error_log_t;
|
||||
#define error_log_dump(error_log, fd, prefix, lines, limit_ns) (0)
|
||||
#define error_log_create(entries, aggregate_ns) (0)
|
||||
#define error_log_destroy(error_log) (0)
|
||||
#endif
|
||||
#ifndef LINUX_ENABLED
|
||||
#include <audio_utils/Statistics.h>
|
||||
#include <audio_utils/clock.h>
|
||||
#endif
|
||||
#include "audio_defs.h"
|
||||
#include "voice.h"
|
||||
#include "audio_hw_extn_api.h"
|
||||
#include "device_utils.h"
|
||||
|
||||
#if LINUX_ENABLED
|
||||
typedef struct {
|
||||
int64_t n;
|
||||
double min;
|
||||
double max;
|
||||
double last;
|
||||
double mean;
|
||||
} simple_stats_t;
|
||||
#define NANOS_PER_SECOND 1000000000LL
|
||||
#endif
|
||||
|
||||
#if LINUX_ENABLED
|
||||
#if defined(__LP64__)
|
||||
#define VISUALIZER_LIBRARY_PATH "/usr/lib64/libqcomvisualizer.so"
|
||||
|
@ -483,8 +503,9 @@ struct stream_out {
|
|||
mix_matrix_params_t downmix_params;
|
||||
bool set_dual_mono;
|
||||
bool prev_card_status_offline;
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
error_log_t *error_log;
|
||||
#endif
|
||||
bool pspd_coeff_sent;
|
||||
|
||||
int car_audio_stream; /* handle for car_audio_stream */
|
||||
|
@ -559,8 +580,9 @@ struct stream_in {
|
|||
int64_t frames_read; /* total frames read, not cleared when entering standby */
|
||||
int64_t frames_muted; /* total frames muted, not cleared when entering standby */
|
||||
|
||||
#ifndef LINUX_ENABLED
|
||||
error_log_t *error_log;
|
||||
|
||||
#endif
|
||||
simple_stats_t start_latency_ms;
|
||||
|
||||
int car_audio_stream; /* handle for car_audio_stream*/
|
||||
|
|
Loading…
Reference in New Issue