From fae63c8e1d77749969cf09cbd9f575d83c46c597 Mon Sep 17 00:00:00 2001 From: Marco Bascetta Date: Wed, 17 Jan 2018 08:52:30 +0100 Subject: [PATCH 03/23] audiofilters/alsa: fixed reference errors when compiled with EPIPE_BUGFIX defined Also added ENABLE_ALSA_EPIPE_BUGFIX cmake option. --- CMakeLists.txt | 4 ++++ src/audiofilters/alsa.c | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c42aeb4..10e126b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,7 @@ cmake_dependent_option(ENABLE_OSS "Enable OSS support." NO "ENABLE_SOUND;LINUX_O cmake_dependent_option(ENABLE_PORTAUDIO "Enable portaudio native support." NO "ENABLE_SOUND" NO) cmake_dependent_option(ENABLE_PULSEAUDIO "Enable pulseaudio support." YES "ENABLE_SOUND" NO) option(ENABLE_ALSA_THREADED "Build mediastreamer2 with threaded ALSA MSFilter." NO) +option(ENABLE_ALSA_EPIPE_BUGFIX "Build mediastreamer2 with ALSA MSFilter with EPIPE bugfix." NO) option(ENABLE_G726 "Build mediastreamer2 with the G726 codec." NO) option(ENABLE_GSM "Build mediastreamer2 with the GSM codec." YES) option(ENABLE_BV16 "Build mediastreamer2 with the BV16 codec." YES) @@ -479,6 +480,9 @@ endif() if(ENABLE_ALSA_THREADED) set(__ALSA_THREADED_VERSION__ 1) endif() +if(ENABLE_ALSA_EPIPE_BUGFIX) + set(__ALSA_EPIPE_BUGFIX__ 1) +endif() if(ENABLE_ARTSC) set(__ARTS_ENABLED__ 1) endif() diff --git a/src/audiofilters/alsa.c b/src/audiofilters/alsa.c index 9ae01fa8..22b82900 100644 --- a/src/audiofilters/alsa.c +++ b/src/audiofilters/alsa.c @@ -48,9 +48,13 @@ then try incrementing the number of periods*/ #define ALSA_PERIODS 8 #define ALSA_PERIOD_SIZE 256 -/*uncomment the following line if you have problems with an alsa driver -having sound quality trouble:*/ -/*#define EPIPE_BUGFIX 1*/ +/* Compile with ENABLE_ALSA_EPIPE_BUGFIX cmake option + * if you have problems with an alsa driver + * having sound quality trouble: + */ +#ifdef __ALSA_EPIPE_BUGFIX__ +# define EPIPE_BUGFIX 1 +#endif /* __ALSA_THREADED_VERSION__ */ static MSSndCard * alsa_card_new(const char *id, const char *pcmbasename); static MSSndCard *alsa_card_duplicate(MSSndCard *obj); @@ -203,7 +207,7 @@ static int alsa_set_params(snd_pcm_t *pcm_handle, int rw, int bits, int stereo, static void alsa_fill_w (snd_pcm_t *pcm_handle) { snd_pcm_hw_params_t *hwparams=NULL; - int channels; + unsigned int channels; snd_pcm_uframes_t buffer_size; int buffer_size_bytes; void *buffer; @@ -1179,7 +1183,7 @@ void alsa_write_process(MSFilter *obj){ ad->write_started=TRUE; ad->handle=alsa_open_w(ad->pcmdev,16,ad->nchannels==2,ad->rate); #ifdef EPIPE_BUGFIX - alsa_fill_w (ad->pcmdev); + alsa_fill_w (ad->handle); #endif } if (ad->handle==NULL) { -- 2.11.0