Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
alsa: hardcode S16_LE sample format
Browse files Browse the repository at this point in the history
Audio sample format from sound card is endian-independent.
  • Loading branch information
RoEdAl committed Nov 2, 2023
1 parent 723520c commit 1e8f603
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/chan_quectel.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ static int pcm_init(struct pvt* pvt, const char* dev, snd_pcm_stream_t stream, c
goto alsa_fail;
}

res = snd_pcm_hw_params_set_format(handle, hwparams, format);
res = snd_pcm_hw_params_set_format(handle, hwparams, pcm_format);
if (res < 0) {
ast_log(LOG_ERROR, "[%s][ALSA][%s] HW Set format failed: %s\n", PVT_ID(pvt), stream_str, snd_strerror(res));
goto alsa_fail;
Expand Down
9 changes: 2 additions & 7 deletions src/chan_quectel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,8 @@
#include "cpvt.h" /* struct cpvt */
#include "dc_config.h" /* pvt_config_t */

#define ALSA_PCM_NEW_HW_PARAMS_API
#define ALSA_PCM_NEW_SW_PARAMS_API
#if __BYTE_ORDER == __LITTLE_ENDIAN
static const snd_pcm_format_t format = SND_PCM_FORMAT_S16_LE;
#else
static const snd_pcm_format_t format = SND_PCM_FORMAT_S16_BE;
#endif
static const snd_pcm_format_t pcm_format = SND_PCM_FORMAT_S16_LE;

#define MAX_BUFFER_SIZE 100
#define MODULE_DESCRIPTION "Channel Driver for Mobile Telephony"
#define MAXQUECTELDEVICES 128
Expand Down

0 comments on commit 1e8f603

Please sign in to comment.