The adrian module was using home-brewed endianness conversion instead of
the appropriate mactos, and speex assumed a little-endian host. This
fixes both of these.
#endif
#include <pulsecore/modargs.h>
+#include <pulsecore/endianmacros.h>
#include "echo-cancel.h"
/* should be between 10-20 ms */
for (i = 0; i < ec->params.priv.adrian.blocksize; i += 2) {
/* We know it's S16LE mono data */
- int r = (((int8_t) rec[i + 1]) << 8) | rec[i];
- int p = (((int8_t) play[i + 1]) << 8) | play[i];
+ int r = PA_INT16_FROM_LE(*(int16_t *)(rec + i));
+ int p = PA_INT16_FROM_LE(*(int16_t *)(play + i));
int res;
res = AEC_doAEC(ec->params.priv.adrian.aec, r, p);
static void pa_speex_ec_fixate_spec(pa_sample_spec *source_ss, pa_channel_map *source_map,
pa_sample_spec *sink_ss, pa_channel_map *sink_map)
{
- source_ss->format = PA_SAMPLE_S16LE;
+ source_ss->format = PA_SAMPLE_S16NE;
*sink_ss = *source_ss;
*sink_map = *source_map;