Re: Segmentation fault when changing rate converter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 10, 2012 at 10:04:50AM +0200, Takashi Iwai wrote:
> 
> The rate_converter definition seems dropped by some reason, then it
> segfaults at the error path.  Does the patch below fix the segfault?
> It won't fix the issue where no proper rate_convert is passed,
> though.
> 
> 
> Takashi
> 

Hello Takashi,

Your patch fixes the segmentation fault:

aplay -v -D plug:48khq 09\ -\ tam\ tam.wav                                
Playing WAVE '09 - tam tam.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
ALSA lib dlmisc.c:236:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib64/alsa-lib/libasound_module_rate_.so
ALSA lib pcm_rate.c:1399:(snd_pcm_rate_open) Cannot find rate converter
aplay: set_params:1145: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (85333 85334)
PERIOD_SIZE: (3763 3764)
PERIOD_BYTES: (15052 15056)
PERIODS: (3 4)
BUFFER_TIME: (341315 341316)
BUFFER_SIZE: 15052
BUFFER_BYTES: 60208
TICK_TIME: 0

Any idea why the rate converter name is dropped?

Kind regards,
Sebastian


> ---
> diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
> index a15c3af..4ba8521 100644
> --- a/src/pcm/pcm_rate.c
> +++ b/src/pcm/pcm_rate.c
> @@ -1394,13 +1394,13 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
>  		}
>  	} else {
>  		SNDERR("Invalid type for rate converter");
> -		snd_pcm_close(pcm);
> +		snd_pcm_free(pcm);
>  		free(rate);
>  		return -EINVAL;
>  	}
>  	if (err < 0) {
>  		SNDERR("Cannot find rate converter");
> -		snd_pcm_close(pcm);
> +		snd_pcm_free(pcm);
>  		free(rate);
>  		return -ENOENT;
>  	}
> @@ -1409,7 +1409,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
>  	open_func = SND_PCM_RATE_PLUGIN_ENTRY(linear);
>  	err = open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops);
>  	if (err < 0) {
> -		snd_pcm_close(pcm);
> +		snd_pcm_free(pcm);
>  		free(rate);
>  		return err;
>  	}
> @@ -1418,7 +1418,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
>  	if (! rate->ops.init || ! (rate->ops.convert || rate->ops.convert_s16) ||
>  	    ! rate->ops.input_frames || ! rate->ops.output_frames) {
>  		SNDERR("Inproper rate plugin %s initialization", type);
> -		snd_pcm_close(pcm);
> +		snd_pcm_free(pcm);
>  		free(rate);
>  		return err;
>  	}

------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user


[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux